home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
music4c.sit
/
Music4C Folder
/
orchestras
/
HoweExample2.c
< prev
next >
Wrap
Text File
|
1990-09-08
|
2KB
|
102 lines
/*
* ⌐ Graeme Gerrard 1990
* Faculty of Music, University of Melbourne
* Parkville Victoria 3052 Australia.
*
* ARPANET: grae@murdu.ucs.unimelb.edu.au
* telephone: (613) 344 4127, Fax: (613) 344 5104
*/
#include "Music4C.h"
#include <math.h>
#include "ugens.h"
#include "orch.h"
#define EXAMPLE2a 1 /* gliss instrument */
#define EXAMPLE2b 2 /* formant instrument */
#define MAXINS 1
static double *b;
static int j[MAXINS+1];
extern FILE *ReportFile;
static long base;
long sampno;
void initl()
{
register long k;
b = (double *)NewPtr(17 * sizeof(double));
for ( k = 0; k < 17; k++ )
*(b+k) = 0.0;
sampno = 0L;
}
void setup()
{
/*
* Parameters for instrument 'b':
* p4 = pitch level of cluster of nonharmonic partials
* p5 = amp
* p6 = amount of AM
* p7 = speed of AM in cps
* p8 = func no of shape of AM
* p9 = func no indicating cluster of partials
*
*/
switch(instype) {
case EXAMPLE2a:
break;
case EXAMPLE2b:
*b = p[6];
*(b+1) = cycle(p[7]);
j[0] = (int)p[8];
j[1] = (int)p[9];
*(b+2) = 0.0;
*(b+3) = p[5];
*(b+5) = pitch(p[4]);
linset(0.05, p[3], p[3] - 0.25, (b+9));
break;
default:
/*fprintf(stderr, "error in instrument type number, %d\n", instype);*/
;
}
}
void orch()
{
register double x;
switch(instype) {
case EXAMPLE2a:
break;
case EXAMPLE2b:
x = oscil(*b, *(b+1), j[0], (b+2)) + *(b+3);
x = formnt(x, *(b+5), 1, j[1], 4, 2, (b+6));
x = linens(x, (b+9));
/* output(0.0, x, 0.0, 0.0);*/
Mono(x*10000);
break;
default:
fprintf(stderr, "error in instrument type number, %d\n", instype);
}
sampno++;
}
void ter()
{
/* just gets called at the end a note for clean up etc. */
}
void final()
{
/* called at the end of the synth run.
* close any files etc. you haven't already closed here.
*/
}